<?php

declare(strict_types=1);

namespace ImiApp\ApiServer\Api\Model\Base;

use Imi\Config\Annotation\ConfigValue;
use Imi\Model\Annotation\Column;
use Imi\Model\Annotation\DDL;
use Imi\Model\Annotation\Entity;
use Imi\Model\Annotation\Table;
use ImiApp\ImiServer\AbstractModel as Model;

use Imi\Model\Annotation\Relation\OneToOne;
use Imi\Model\Annotation\Relation\JoinFrom;
use Imi\Model\Annotation\Relation\JoinTo;
use Imi\Model\Annotation\Relation\AutoSave;
use Imi\Model\Annotation\Relation\AutoDelete;
use ImiApp\ApiServer\Api\Model\Artclecate;

/**
 * 平台文章 基类.
 *
 * @property \ImiApp\ApiServer\Api\Model\Artclecate $ex
 * @Entity(camel=false, bean=true, incrUpdate=false)
 * @Table(name=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Artcle.name", default="fa_artcle"), usePrefix=false, id={"id"}, dbPoolName=@ConfigValue(name="@app.models.ImiApp\ApiServer\Api\Model\Artcle.poolName"))
 * @DDL(sql="CREATE TABLE `fa_artcle` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '公告ID',
  `name` varchar(50) NOT NULL COMMENT '标题',
  `content` text COMMENT '公告内容',
  `artclecate_id` int(10) unsigned DEFAULT NULL COMMENT '文章分类',
  `switch` tinyint(1) DEFAULT '1' COMMENT '显示',
  `views` int(10) unsigned DEFAULT '0' COMMENT '浏览量',
  `weigh` int(10) unsigned DEFAULT NULL,
  `createtime` int(10) unsigned DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
  `deletetime` int(10) unsigned DEFAULT NULL COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台文章'", decode="")
 *
 * @property int|null $id 公告ID
 * @property string|null $name 标题
 * @property string|null $content 公告内容
 * @property int|null $artclecateId 文章分类
 * @property int|null $switch 显示
 * @property int|null $views 浏览量
 * @property int|null $weigh 
 * @property int|null $createtime 创建时间
 * @property int|null $updatetime 更新时间
 * @property int|null $deletetime 删除时间
 */
abstract class ArtcleBase extends Model
{
    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEY = 'id';

    /**
     * {@inheritdoc}
     */
    public const PRIMARY_KEYS = ["id"];

    /**
     * 公告ID.
     * id
     * @Column(name="id", type="int", length=10, accuracy=0, nullable=false, default="", isPrimaryKey=true, primaryKeyIndex=0, isAutoIncrement=true, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $id = NULL;




    /**
     * 获取 id - 公告ID.
     *
     * @return int|null
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * 赋值 id - 公告ID.
     * @param int|null $id id
     * @return static
     */
    public function setId($id)
    {
        $this->id = null === $id ? null : (int)$id;
        return $this;
    }

    /**
     * 标题.
     * name
     * @Column(name="name", type="varchar", length=50, accuracy=0, nullable=false, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $name = NULL;

    /**
     * 获取 name - 标题.
     *
     * @return string|null
     */
    public function getName(): ?string
    {
        return $this->name;
    }

    /**
     * 赋值 name - 标题.
     * @param string|null $name name
     * @return static
     */
    public function setName($name)
    {
        $this->name = null === $name ? null : (string)$name;
        return $this;
    }

    /**
     * 公告内容.
     * content
     * @Column(name="content", type="text", length=0, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var string|null
     */
    protected ?string $content = NULL;

    /**
     * 获取 content - 公告内容.
     *
     * @return string|null
     */
    public function getContent(): ?string
    {
        return $this->content;
    }

    /**
     * 赋值 content - 公告内容.
     * @param string|null $content content
     * @return static
     */
    public function setContent($content)
    {
        $this->content = null === $content ? null : (string)$content;
        return $this;
    }

    /**
     * 文章分类.
     * artclecate_id
     * @Column(name="artclecate_id", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $artclecateId = NULL;

    /**
     * @OneToOne("Artclecate")
     * @JoinFrom("artclecate_id")
     * @JoinTo("id")
     */
    protected ?\ImiApp\ApiServer\Api\Model\Artclecate $ex = null;



    /**
     * Get the value of ex
     */
    public function getEx(): ?\ImiApp\ApiServer\Api\Model\Artclecate
    {
        return $this->ex;
    }
 
    /**
     * Set the value of ex
     *
     * @return  self
     */
    public function setEx(?\ImiApp\ApiServer\Api\Model\Artclecate $ex)
    {
        $this->ex = $ex;
 
        return $this;
    }



    /**
     * 获取 artclecateId - 文章分类.
     *
     * @return int|null
     */
    public function getArtclecateId()
    {
        return $this->artclecateId;

        // return $this->cate;
    }





    /**
     * 赋值 artclecateId - 文章分类.
     * @param int|null $artclecateId artclecate_id
     * @return static
     */
    public function setArtclecateId($artclecateId)
    {
        $this->artclecateId = null === $artclecateId ? null : (int)$artclecateId;
        return $this;
    }

    /**
     * 显示.
     * switch
     * @Column(name="switch", type="tinyint", length=1, accuracy=0, nullable=true, default="1", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=false, virtual=false)
     * @var int|null
     */
    protected ?int $switch = 1;

    /**
     * 获取 switch - 显示.
     *
     * @return int|null
     */
    public function getSwitch(): ?int
    {
        return $this->switch;
    }

    /**
     * 赋值 switch - 显示.
     * @param int|null $switch switch
     * @return static
     */
    public function setSwitch($switch)
    {
        $this->switch = null === $switch ? null : (int)$switch;
        return $this;
    }

    /**
     * 浏览量.
     * views
     * @Column(name="views", type="int", length=10, accuracy=0, nullable=true, default="0", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $views = 0;

    /**
     * 获取 views - 浏览量.
     *
     * @return int|null
     */
    public function getViews(): ?int
    {
        return $this->views;
    }

    /**
     * 赋值 views - 浏览量.
     * @param int|null $views views
     * @return static
     */
    public function setViews($views)
    {
        $this->views = null === $views ? null : (int)$views;
        return $this;
    }

    /**
     * weigh.
     * @Column(name="weigh", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $weigh = NULL;

    /**
     * 获取 weigh.
     *
     * @return int|null
     */
    public function getWeigh(): ?int
    {
        return $this->weigh;
    }

    /**
     * 赋值 weigh.
     * @param int|null $weigh weigh
     * @return static
     */
    public function setWeigh($weigh)
    {
        $this->weigh = null === $weigh ? null : (int)$weigh;
        return $this;
    }

    /**
     * 创建时间.
     * createtime
     * @Column(name="createtime", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $createtime = NULL;

    /**
     * 获取 createtime - 创建时间.
     *
     * @return int|null
     */
    public function getCreatetime(): ?int
    {
        return $this->createtime;
    }

    /**
     * 赋值 createtime - 创建时间.
     * @param int|null $createtime createtime
     * @return static
     */
    public function setCreatetime($createtime)
    {
        $this->createtime = null === $createtime ? null : (int)$createtime;
        return $this;
    }

    /**
     * 更新时间.
     * updatetime
     * @Column(name="updatetime", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $updatetime = NULL;

    /**
     * 获取 updatetime - 更新时间.
     *
     * @return int|null
     */
    public function getUpdatetime(): ?int
    {
        return $this->updatetime;
    }

    /**
     * 赋值 updatetime - 更新时间.
     * @param int|null $updatetime updatetime
     * @return static
     */
    public function setUpdatetime($updatetime)
    {
        $this->updatetime = null === $updatetime ? null : (int)$updatetime;
        return $this;
    }

    /**
     * 删除时间.
     * deletetime
     * @Column(name="deletetime", type="int", length=10, accuracy=0, nullable=true, default="", isPrimaryKey=false, primaryKeyIndex=-1, isAutoIncrement=false, unsigned=true, virtual=false)
     * @var int|null
     */
    protected ?int $deletetime = NULL;

    /**
     * 获取 deletetime - 删除时间.
     *
     * @return int|null
     */
    public function getDeletetime(): ?int
    {
        return $this->deletetime;
    }

    /**
     * 赋值 deletetime - 删除时间.
     * @param int|null $deletetime deletetime
     * @return static
     */
    public function setDeletetime($deletetime)
    {
        $this->deletetime = null === $deletetime ? null : (int)$deletetime;
        return $this;
    }

}
